package com.wangsd.web.face.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 商户配置
 */
@Data
@Entity
@Table(name = "merchant")
@ApiModel(value = "商户", description = "商户配置信息")
public class Merchant implements Serializable {

    @ApiModelProperty(value = "商户名称")
    private String name;
    @ApiModelProperty(value = "商户logo")
    private String logoUrl;
    @ApiModelProperty(value = "广告图片地址")
    private String advertisementPicUrl;
    @ApiModelProperty(value = "广告链接地址")
    private String advertisementUrl;
    @ApiModelProperty(value = "商户号")
    private String subMchId;
    @ApiModelProperty(value = "商户公众号ID")
    private String subAppId;
    @ApiModelProperty(value = "公众微信号")
    private String subAppAccount;
    @ApiModelProperty(value = "代理商ID")
    private Long agentId;
    @ApiModelProperty(value = "支付宝授权TOKEN")
    private String aliAuthToken;

    @ApiModelProperty(value = "消费N元得1积分,默认1:1（单位：分）")
    @Column(name = "monetary", columnDefinition = "bigint(20) default 100 not null")
    private Long monetary;

    @ApiModelProperty(value = "是否开启会员注册邀请")
    @Column(name = "is_member", columnDefinition = "int(1) default 0 not null")
    private Long isMember;

    //服务商使用功能
    @ApiModelProperty(value = "订单金额最低多少开始抽成")
    @Column(name = "minimum_draw", columnDefinition = "int(20) default 0 not null")
    private Long minimumDraw;

    @ApiModelProperty(value = "每笔抽多少钱")
    @Column(name = "per_draw", columnDefinition = "int(20) default 0 not null")
    private Long perDraw;

    @ApiModelProperty(value = "商户总抽成金额")
    @Column(name = "draw_total_fee", columnDefinition = "int(20) default 0 not null")
    private Long drawTotalFee;

    @ApiModelProperty(value = "商户已抽成金额(注：只能查看，不能修改)")
    @Column(name = "draw_fee", columnDefinition = "int(20) default 0 not null")
    private Long drawFee;

    @ApiModelProperty(value = "公众号和小程序是否关联")
    @Column(name = "is_relation", columnDefinition = "int(1) default 0 not null")
    private Integer isRelation;

    @ApiModelProperty(value = "公众号Secret")
    private String appSecret;

    @ApiModelProperty(value = "支付通道 ,0,默认走微信通道，1 通用通")
    @Column(name = "pay_way", columnDefinition = "int(1) default 0 not null")
    private Integer payWay;
    @ApiModelProperty(value = "支付账号")
    private String payAccount;
    @ApiModelProperty(value = "支付密钥")
    private String payKey;

    /**
     * 商户和小程序信息
     */
    @ApiModelProperty(value = "商户对应小程序appid")
    private String miniAppid;
    @ApiModelProperty(value = "小程序密钥")
    private String miniSecret;
    @ApiModelProperty(value = "小程序token")
    private String miniToken;
    @ApiModelProperty(value = "小程序key")
    private String miniAesKey;


    @ApiModelProperty(value = "商户退款密码")
    @Column(name = "refund_secret", columnDefinition = "varchar(50) default 123456 not null")
    private String refundSecret;

    /**
     * 以下是通用字段
     */
    @Id
    @TableId(type = IdType.AUTO)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;

    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;

    @ApiModelProperty(value = "检索标识")
    private String code;

    /**
     * 扩展字段
     */
    @ApiModelProperty(value = "代理商名称")
    @Transient
    @TableField(exist = false)
    private String agentName;

    @ApiModelProperty(value = "服务商名称")
    @Transient
    @TableField(exist = false)
    private String businessName;
}
